package config.ioc;

import com.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 练习步骤：
 * 1.容器功能
 * 1.1 配置类的编写
 * 1.2 生命周期的方法 Bean属性的initMethod destroyMethod
 * <p>
 * <p>
 * 2. IOC的4种情况
 * <p>
 * 3. 多个配置元数据的整合
 * 3.1 Import
 * 3.2 ImportResource
 * //不需要到上面2个注解
 * new ANno(AConfig.class,BConfig.class);
 */
public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(HelloIocConfig.class);
//        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(HelloIocConfig2.class);
//        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(HelloIocConfig3.class);
        //AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(HelloIocConfig4.class, HelloIocConfig42.class);

        UserService service = context.getBean(UserService.class);
        service.insert();
    }
}
